import React, { useEffect } from 'react';
import { View, Text, Animated } from 'react-native';

const Notification = ({ message, duration=3000 }) => {
  const fadeAnim = new Animated.Value(0);

  useEffect(() => {
    Animated.sequence([
      Animated.timing(fadeAnim, { toValue: 1, duration: 300 }),
      Animated.delay(duration),
      Animated.timing(fadeAnim, { toValue: 0, duration: 300 })
    ]).start();
  }, []);

  return (
    <Animated.View style={[styles.container, { opacity: fadeAnim }]}>
      <Text>{message}</Text>
    </Animated.View>
  );
};

export default Notification;